package io.renren.modules.generator.service.impl;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import io.renren.modules.generator.entity.ActivityinfoEntity;
import io.renren.modules.generator.entity.DepartmentEntity;
import io.renren.modules.generator.entity.EmployeeEntity;
import io.renren.modules.generator.service.ActivityinfoService;
import io.renren.util.UUIDUtil;



@Service("activityinfoService")
public class ActivityinfoServiceImpl extends BaseServiceImpl implements ActivityinfoService {
	
	
	@Override
	public ActivityinfoEntity queryObject(String activityno){
		ActivityinfoEntity activityinfoEntity = activityinfoDao.queryObject(activityno);
		EmployeeEntity employeeEntity = employeeDao.queryObject(activityinfoEntity.getActivitior());
		if(null != employeeEntity && !"".equals(employeeEntity.getName())){
			activityinfoEntity.setActivitiorName(employeeEntity.getName());
			DepartmentEntity departmentEntity = departmentDao.queryObject(employeeEntity.getDeptno());
			if(null != departmentEntity && !"".equals(departmentEntity.getName())){
				activityinfoEntity.setDeptnoName(departmentEntity.getName());
			}
		}
		return activityinfoEntity;
	}
	
	@Override
	public List<ActivityinfoEntity> queryList(Map<String, Object> map){
		return activityinfoDao.queryList(map);
	}
	
	@Override
	public int queryTotal(Map<String, Object> map){
		return activityinfoDao.queryTotal(map);
	}
	
	@Override
	public void save(ActivityinfoEntity activityinfo){
		activityinfo.setActivityno(UUIDUtil.getOrderIdByUUId());
		activityinfoDao.save(activityinfo);
	}
	
	@Override
	public void update(ActivityinfoEntity activityinfo){
		activityinfoDao.update(activityinfo);
	}
	
	@Override
	public void delete(String activityno){
		activityinfoDao.delete(activityno);
	}
	
	@Override
	public void deleteBatch(String[] activitynos){
		activityinfoDao.deleteBatch(activitynos);
	}
	
}
